import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from "node:path"

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  //路径别名设置
  resolve: {
    alias: {
      '@': resolve(__dirname,'src')
    },
  },
  //配置服务信息
  //通过服务代理实现跨域
  server: {
    host: '0.0.0.0',
    port: 5173,
    strictPort: true,
    open: true,
    proxy:{
      '/travel-api':{
        target: 'http://localhost:8080',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/,'api')
      }
    }
  }
})